<%@page import="catalogue.Catalogue"%>
<%@page import="catalogue.DVD"%>
<%@page import="java.util.Iterator"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
    <!-- Instanciation du bean dvdAffiche -->
    <jsp:useBean id="dvdAffiche" scope = "application" class="catalogue.DVD" />
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>Catalogue</title>
    </head>
    <body>
        <h3 align ="center">Contenu du catalogue DVD</h3>
        <table align="center" border=2 cellspacing=4 cellpadding=4 width=30%>
            <tr>
                <th>Description</th>
                <th>Prix</th>
            </tr>      
            <%
                Catalogue cat = (Catalogue) request.getAttribute("catalogue");
                Iterator<DVD> iDVD = cat.getCat().iterator();
                while (iDVD.hasNext()) {
                    DVD d = iDVD.next();
            %>
            <!-- On remplis le bean avec le dvd d -->
            <jsp:setProperty name="dvdAffiche" property="description" value="<%=d.getDescription()%>"/>
            <jsp:setProperty name="dvdAffiche" property="prix" value="<%=d.getPrix()%>"/>
            <!-- On affiche le dvd -->
            <tr>
                <th><jsp:getProperty name="dvdAffiche" property="description"/></th>
                <th><jsp:getProperty name="dvdAffiche" property="prix"/></th>
            </tr>       
            <% }%>
        </table>
        <form method=post action="index.jsp">
            <p align="center">
                <input type="submit" value="Retour"/>
            </p>
        </form>
    </body>
</html>
